App({
  payData:{},
  onLaunch(options) {
    // 第一次打开
    // options.query == {number:1}
    //console.info('App onLaunch');
  },
  onShow(options) {
    // 从后台被 scheme 重新打开
    // options.query == {number:1}
    this.payData = options.query
  },
  editTabBar: function () {
    
    var tabBar= this.globalData.tabbar;//获取tabbar的数据赋值给tabBar
    var pages = getCurrentPages();//获取当前页面栈的实例，以数组形式按栈的顺序给出
    var currentPage = pages[pages.length - 1];
    var url = '/' + currentPage .route;//获取路径
    for (var i = 0; i < tabBar.items.length; i++) {
      tabBar.items[i].active = false;//令所有的底部导航都是正常状态
      if (tabBar.items[i].pagePath == url) {//若是点击的路径
        tabBar.items[i].active = true;//根据页面地址设置当前页面状态
      }
    }
    //设置数据
    currentPage.setData({
       tabbar:tabBar
    });
  },
  globalData: {
    userInfo: null,
    //配置tabbar  
    tabbar: {
      textColor: "#999",
      selectedColor: "#108ee9",
      backgroundColor: "#fff",
      borderStyle: "#FFF",
      items: [     
        {
          pagePath: "/pages/index/index",
          name: "首页",
          icon: "/img/home-normal.png",//未选icon
          activeIcon: "/img/home-active.png"//选中icon
        },
        // {
        //   pagePath: "/pages/h5/h5",
        //   name: "商城",
        //   icon: "/img/shoop-normal.png",
        //   activeIcon: "/img/shoop-active.png"
        // }       
      ],
      position: "bottom"
    }
  },
});
